using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SMS.Common.Data;
using SMS.Framework;

namespace SMS.Inventory
{
    public partial class NewOrderTemplateChooseForm : Form
    {
        public NewOrderTemplateChooseForm()
        {
            InitializeComponent();
            comboBox1.Items.AddRange(MaterialDB.GetOrderCategory(Context.Current.AppInfo.LocalDbConnectionString).ToArray());
            if (comboBox1.Items.Count>0)
            {
                comboBox1.SelectedIndex = 0;
            }
            else
            {
                button1.Enabled = false;
            }
        }

        public string SelectedOrderCategory
        {
            get
            {
                if (this.DialogResult == DialogResult.OK)
                {
                    return this.comboBox1.Text;
                }
                return null;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

    }
}